/*
*Copyright 2021-2023 NERCIS
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/

package cn.ac.nercis.pes.community.model.vo.knowledge;

import javafx.beans.property.SimpleStringProperty;
import org.apache.commons.lang3.StringUtils;

/**
 * 整改建议信息（知识库）修改视图模型
 * @author zpy
 * @version 1.0.0
 */
public class KmSuggestVO {
    private final SimpleStringProperty id = new SimpleStringProperty();
    private final SimpleStringProperty unitTargetId = new SimpleStringProperty();
    private final SimpleStringProperty unitTargetName = new SimpleStringProperty();
    private final SimpleStringProperty suggest = new SimpleStringProperty();
    private boolean change = false;

    public boolean isChange(){
        return change;
    }

    public void resetChange(){
        change = false;
    }

    public String getId() {
        return id.get();
    }

    public SimpleStringProperty idProperty() {
        return id;
    }

    public void setId(String id) {
        this.id.set(id);
    }

    public String getUnitTargetId() {
        return unitTargetId.get();
    }

    public SimpleStringProperty unitTargetIdProperty() {
        return unitTargetId;
    }

    public void setUnitTargetId(String unitTargetId) {
        if(!StringUtils.equals(getUnitTargetId(),unitTargetId)){
            change = true;
        }
        this.unitTargetId.set(unitTargetId);
    }

    public String getUnitTargetName() {
        return unitTargetName.get();
    }

    public SimpleStringProperty unitTargetNameProperty() {
        return unitTargetName;
    }

    public void setUnitTargetName(String unitTargetName) {
        if(!StringUtils.equals(getUnitTargetName(),unitTargetName)){
            change = true;
        }
        this.unitTargetName.set(unitTargetName);
    }

    public String getSuggest() {
        return suggest.get();
    }

    public SimpleStringProperty suggestProperty() {
        return suggest;
    }

    public void setSuggest(String suggest) {
        if(!StringUtils.equals(getSuggest(),suggest)){
            change = true;
        }
        this.suggest.set(suggest);
    }
}